
global usr muhammed
*global usr sbustos

net from "/Users/$usr/Copy/Muhammed-Sebastian/Complexity_Codes/ecomplexity"
net install ecomplexity_ex, force

/*
net from http://ecomplexity.googlecode.com/hg/
net describe ecomplexity, from("http://ecomplexity.googlecode.com/hg/")
net install ecomplexity, from("http://ecomplexity.googlecode.com/hg/") force
*/
***** Do file for testing new complexity codes
/*
clear all

cd "/Users/$usr/Copy/Muhammed-Sebastian/"
*sysdir set PERSONAL "/Users/muhammed/Copy/Muhammed-Sebastian/Complexity_Codes"
use "/Users/$usr/Copy/CEPII/cepii_all.dta", clear

keep year iso hs4 export_value
keep if year>=2010
egen key=tag(iso)
gen auxrnd=uniform() if key==1
egen aleatorio=mean(auxrnd), by(iso)
keep if aleatorio<0.3
egen keyp=tag(hs4)
gen auxrndp=uniform() if keyp==1
egen aleatoriop=mean(auxrndp), by(hs4)
keep if aleatoriop<0.5
keep year iso hs4 export_value

cap rename eci eciold
cap rename pci pciold
*keep year iso hs4 export_value eciold pciold

ecomplexity_ex export_value, i(iso) p(hs4)  rca(1) 
*genproximity export_value, i(iso) p(hs4) t(year) rca(0.5) asym
*/

******************
clear all
global usr sbustos
net from "/Users/$usr/Copy/Muhammed-Sebastian/Complexity_Codes/ecomplexity"
net install ecomplexity, force
cd "/Users/$usr/Copy/Muhammed-Sebastian/"
*sysdir set PERSONAL "/Users/muhammed/Copy/Muhammed-Sebastian/Complexity_Codes"
use "/Users/$usr/Copy/CEPII/cepii_all.dta", clear

keep if year==2010
drop if export_value == 0 | export_value == .
drop if population == 0 | population == .
cap rename eci eciold
cap rename pci pciold
keep year iso hs4 export_value population eciold pciold

*keep year iso hs4 export_value eciold pciold

*ecomplexity_ex export_value, i(iso) p(hs4) t(year) rpop(2) pop(population) cont knn(30)
ecomplexity export_value, i(iso) p(hs4) t(year) cont
